package com.flute.haflute.jobbox.common;

import java.io.IOException;

import org.jdom.JDOMException;

/**
 * 分布式节点环境、参数的共同配置 用于系统通用环境的配置、初始化等
 * 
 */
public class CommonConfiguration {
	// 日志存储的配置文件，log4j
	private static final String masterLogConfFile = "conf/log-master.lcf";
	private static final String childLogConfFile = "conf/log-child.lcf";

	// 配置环境参数
	private void configLogger(boolean isMaster) {
		if (isMaster) {
			org.apache.log4j.PropertyConfigurator.configure(CloudContext
					.getRootDir() + masterLogConfFile);
		} else
			org.apache.log4j.PropertyConfigurator.configure(CloudContext
					.getRootDir() + childLogConfFile);
	}

	/*
	 * 初始化所有系统、软件和平台环境
	 */
	public void initCloudContext(boolean isMaster) throws JDOMException,
			IOException {
		configLogger(isMaster);
		CloudInfoLoader infoLoader = new CloudInfoLoader();
		infoLoader.load();
	}
}
